import { Blog } from 'src/blog/blog.entity';
import { Entity, Column, PrimaryGeneratedColumn, CreateDateColumn, UpdateDateColumn, OneToMany } from 'typeorm';

@Entity()
export class User {
    @PrimaryGeneratedColumn()
    id: number;

    @Column()
    nickName: string;

    @Column()
    username: string;

    @Column()
    password: string;

    @Column()
    email: string;

    @Column()
    avatar: string;

    @Column()
    type: number

    @Column()
    description: string

    @CreateDateColumn({
        type: "timestamp",
        comment: '创建时间'
    })
    createTime: Date

    @UpdateDateColumn({
        type: "timestamp",
        comment: '更新时间'
    })
    updateTime: Date

    @OneToMany(type => Blog, blog => blog.user)
    blogs: Blog[]
}